<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/admin/common/inc/incSession.jsp" %>
<jsp:include page="/admin/common/inc/Top.jsp" />
<%
	
	String srchEventType = util.getStr(request.getParameter("srchEventType"));
	String srchCond 	= util.getStr(request.getParameter("srchCond")); 
	String srchContent 	= util.getStr(request.getParameter("srchContent"));
	String srchStdt 	= util.getStr(request.getParameter("srchStdt"));
	String srchEndt 	= util.getStr(request.getParameter("srchEndt"));
	String srchUseYn 	= util.getStr(request.getParameter("srchUseYn"));


	// paging
	String perRow 		= util.getStr(request.getParameter("perRow"));
	String startRow 	= util.getStr(request.getParameter("startRow"));
	String currentPage 	= util.getStr(request.getParameter("currentPage"));
	
	perRow = "".equals(perRow) ?"10":perRow;
	startRow = "".equals(startRow)?"0":startRow;
	currentPage = "".equals(currentPage)?"1":currentPage;
	
	
// 	param.put("srchCond",srchCond);
// 	param.put("srchContent",srchContent);
// 	param.put("srchStdt",srchStdt);
// 	param.put("srchEndt",srchEndt);
// 	param.put("srchUseYn",srchUseYn);
	
// 	paging
// 	param.put("perRow", perRow);
// 	param.put("startRow", startRow);
	
	
	
	//param.put("startRow",11);
	//param.put("perRow",10);
	
%>
<script type="text/javascript">
	// 리스트 갯수
	var dispCnt = '${dispCnt}';
	
	$(document).ready(function() {

		createCalendar1();
		createCalendar2();
		createCalendar3();
		
	    // 달력 토글
		$('#calToggle1').bind('click', function(event){
	
			$('#dhtmlxDblCalendar2').hide();
			$('#dhtmlxDblCalendar3').hide();
			$('#dhtmlxDblCalendar1').toggle();
		});
	    
		$('#calToggle2').bind('click', function(event){
			
			$('#dhtmlxDblCalendar1').hide();
			$('#dhtmlxDblCalendar3').hide();
			$('#dhtmlxDblCalendar2').toggle();
		});
		
		$('#calToggle3').bind('click', function(event){
			
			$('#dhtmlxDblCalendar1').hide();
			$('#dhtmlxDblCalendar2').hide();
			$('#dhtmlxDblCalendar3').toggle();
		});
		
		$('#eventType').bind('change', function(event){
			
			var eventInfo =  $('#eventInfo tr>th');
			var eventCode = $(this).val();
			
			if(eventCode == '00'){
				
				jQuery("th[name^='campain']").hide();
				jQuery("th[name^='consumer']").show();
				
			}else{
				
				jQuery("th[name^='consumer']").hide();
				jQuery("th[name^='campain']").show();


			}
		});
		
		//	초기값 셋팅
		$("#srchEventType").val("<%=srchEventType%>");
		$("#srchCond").val("<%=srchCond%>");
		$("#srchContent").val("<%=srchContent%>");
		$("#srchStdt").val("<%=srchStdt%>");
		$("#srchEndt").val("<%=srchEndt%>");
		$("#srchUseYn").val("<%=srchUseYn%>");
		$("#startRow").val("<%=startRow%>");
		$("#currentPage").val("<%=currentPage%>");
		
		
		
		//	등록
		$("#btnCreate").click(function() {
			
			$("#listForm").attr("action","/admin/alliance/allianceDetail_i.jsp");
			$("#listForm").attr("target","hiddenFrame");
			
			if( !confirm("제휴문의를 이벤트로 등록 하시겠습니까?")) return;

			$("#listForm").submit();
			
		});
		
		
		//	등록
		$("#btnCreate").click(function() {
			
			$("#listForm").attr("action","/admin/alliance/allianceDetail_u.jsp");
			$("#listForm").attr("target","hiddenFrame");
			
			if( !confirm("제휴문의를 이벤트로 등록 하시겠습니까?")) return;

			$("#listForm").submit();
			
		});
		
		<%--
		$("#listForm").validate({
			rules: {
				eventType 	: "required",
				categoryCode: "required",
				eventName 	: "required",
				productName	: "required",
				recruitNo   : "required",
				link 		: "required",
				reqFdate 	: "required",
				reqTdate 	: "required",
				reviewFdate : "required",
				reviewTdate : "required",
				winDate 	: "required",
				provideDate : "required",
				useYn 		: "required",
				thumbImg 	: "required",
				detailImg 	: "required"
			},
				
		  	messages: {
		  		eventType 	: "<br/>이벤트 타입을 선택하세요.",
				categoryCode: "<br/>카테고리를 선택하세요.",
				eventName 	: "<br/>이벤트명을 입력하세요.",
				productName	: "<br/>상품명을 입력하세요.",
				recruitNo   : "<br/>모집인원일 입력하세요.",
				link 		: "<br/>관련링크를 입력하세요.",
				reqFdate 	: "<br>이벤트 진행기간을 입력하세요.</br>",
				reqTdate 	: "<br>이벤트 진행기간을 입력하세요.</br>",
				reviewFdate : "<br>이벤트 활동기간을 입력하세요.</br>",
				reviewTdate : "<br>이벤트 활동기간을 입력하세요.</br>",
				winDate 	: "<br>당첨자 발표일을 입력하세요.</br>",
				provideDate : "<br>상품 지급일을 입력하세요.</br>",
				useYn 		: "<br/>사용 여부를 선택하세요.",
				thumbImg 	: "<br/>썸네일 이미지를 선택하세요.",
				detailImg 	: "<br/>상세 이미지를 선택하세요."
		  },
		  
		  submitHandler: function (frm) {
              frm.submit(); // 통과시 전송
          },
          success: function (e) { 
              //
          }                

          
		});
		--%>
		
		//	목록으로
		$("#btnList").click(function() {
			
			$("#listForm").attr("action","/admin/alliance/allianceList.jsp");
			$("#listForm").attr("target","_top");		
			$("#listForm").submit();
			
		});
		
		
		//	초기화
		$("#btnReset").click(function() {
			
			$("input").val("");
			$("select").val("");
			
		});
		
		// 상세
	    jQuery("a[name^='detailAnc']").click(function(){

	    });
		
	});
		
</script>	
	<body>
		<!-- header -->
		<div id="header">
			<jsp:include page="/admin/common/inc/Header.jsp" />
		</div>
		<!-- //header -->
		
		<!-- wrap -->
		<div id="wrap" >
		
			<!-- contentWrap -->
			<div id="contentWrap" >
			
				<!-- topmenu -->
				<jsp:include page="/admin/common/inc/TopMenu.jsp" />
				<!-- //topmenu -->
				
				
				<div id="conts">
				
					<div class="main_view clfix " style="height: 800px;">
						<!-- content -->
						
						
						<form id="listForm" name="listForm" method="post" enctype="multipart/form-data">
						<input type="hidden" name="startRow" id="startRow" value="" />
						<input type="hidden" name="currentPage" id="currentPage" value="" />
						
						<div class="section_main">
							
							<!--btn-->
							<div class="al_right mb20">
								<button type="button" id="btnCreate">이벤트로 등록</button>
								<button type="button" id="btnModify">수정</button>
								 임시 : <button type="button" id="btnTemp">등록</button>
							</div>
							<!--//btn-->
							
							<!--board input-->
							<table class="bdc_input mb10" id="eventInfo">
								<colgroup><col width="20%"><col width="30%"><col width="20%"><col width="30%"></colgroup>
								<tr>
									<th class="cth">이벤트 타입</th>
									<td class="ctd" colspan="3">
										<select id="eventType" name="eventType">
										<%
											param.clear();
											param.put("p_code","ET");
											ArrayList rs =	(ArrayList)sqlMap.queryForList("Common.selectCodeList",param);	//	실행할 SQL ID, 검색조건(없을경우 null)
											
											for( int i = 0 ; i < rs.size() ; i++){
										%>
											<option value="<%=util.getStr(((HashMap)rs.get(i)).get("CODE")) %>"><%=util.getStr(((HashMap)rs.get(i)).get("NAME")) %></option>
										<%		
											}
										%>
										</select>
									</td>
								</tr>
								<tr>
									<th class="cth" name="consumer">체험단 이벤트 진행기간</th>
									<th class="cth" name="campain" style="display: none;">캠페인 이벤트 진행기간</th>
									<td class="ctd">
										<input id="reqFdate" name="reqFdate" type="text" class="txt" style="width: 60px;" readonly="true" value=""/> ~ 
							   	   		<input id="reqTdate" name="reqTdate" type="text" class="txt" style="width: 60px;" readonly="true" value=""/>
							   			<img name="calToggle1" id="calToggle1" src ="/common/calendar/imgs/icon_minicalendar.gif" style="cursor: pointer;"/>
									    <div id="dhtmlxDblCalendar1" style="position: absolute;z-index: 9999;"></div>
									</td>
									<th class="cth" name="consumer">체험단 활동기간(리뷰등록)</th>
									<th class="cth" name="campain" style="display: none;">우수 작가 선정기간</th>
									<td class="ctd">
										<input id="reviewFdate" name="reviewFdate" type="text" class="txt" style="width: 60px;" readonly="true" value=""/> ~ 
							   	   		<input id="reviewTdate" name="reviewTdate" type="text" class="txt" style="width: 60px;" readonly="true" value=""/>
							   			<img name="calToggle2" id="calToggle2" src ="/common/calendar/imgs/icon_minicalendar.gif" style="cursor: pointer;"/>
									    <div id="dhtmlxDblCalendar2" style="position: absolute;z-index: 9999;"></div>
									</td>
								</tr>
								<tr>
									<th class="cth" name="consumer">당첨자 발표일, 체험상품 지급일</th>
									<th class="cth" name="campain" style="display: none;">우수 작가 발표일, 캠페인 경품 지급일</th>
									<td class="ctd">
										<input id="winDate" name="winDate" type="text" class="txt" style="width: 60px;" readonly="true" value=""/>,    
							   	   		<input id="provideDate" name="provideDate" type="text" class="txt" style="width: 60px;" readonly="true" value=""/>
							   			<img name="calToggle3" id="calToggle3" src ="/common/calendar/imgs/icon_minicalendar.gif" style="cursor: pointer;"/>
									    <div id="dhtmlxDblCalendar3" style="position: absolute;z-index: 9999;"></div>
									</td>
									<th class="cth" name="consumer">체험단 선정 인원수</th>
									<th class="cth" name="campain" style="display: none;">캠페인 우수 작가 선정 인원수</th>
									<td class="ctd">
										<input id="recruitNo" name="recruitNo" type="text" class="txt" style="width: 20%" value=""/> 
									</td>
								</tr>
								<tr>
									<th class="cth">우수 체험단 선정 인원수</th>
									<td class="ctd" colspan="3">
										<input id="goodReviewerNo" name="goodReviewerNo" type="text" class="txt" style="width: 60px;" value=""/> 
									</td>
								</tr>
								<tr>
									<th class="cth">우수 체험단 상품 및 참고사항</th>
									<td class="ctd" colspan="3">
										<textarea name="goodReviewerGift" id="goodReviewerGift" rows="8" cols="100%"></textarea>
									</td>
								</tr>
								<tr>
									<th class="cth">당첨자 / 우수 작가 선정 비율</th>
									<td class="ctd" colspan="3">
										<input type="radio" id="chooseRate" name="chooseRate" value="A" /> Meetablog 100%
										<input type="radio" id="chooseRate" name="chooseRate" value="B" style="margin-left: 40px;"/ /> Meetablog 70% / 자사 30%
										<input type="radio" id="chooseRate" name="chooseRate" value="C" style="margin-left: 40px;"/ /> Meetablog 50% / 자사 50%
									</td>
								</tr>
								
								
								
								<tr>
									<th class="cth">업체명</th>
									<td class="ctd">
										<input id="companyName" name="companyName" type="text" class="txt" style="width: 90%" value=""/> 
									</td>
									<th class="cth">홈페이지(URL)</th>
									<td class="ctd">
										<input id="homepage" name="homepage" type="text" class="txt" style="width: 90%" value=""/> 
									</td>
								</tr>
								
								<tr>
									<th class="cth">담당자 / 부서 / 직함</th>
									<td class="ctd">
										<input id="userName" name="userName" type="text" class="txt" style="width: 90%" value=""/> 
									</td>
									<th class="cth">연락처</th>
									<td class="ctd">
										<input id="telNo" name="telNo" type="text" class="txt" style="width: 90%" value=""/> 
									</td>
								</tr>
								
								<tr>
									<th class="cth">메일주소</th>
									<td class="ctd" colspan="3">
										<input id="email" name="email" type="text" class="txt" style="width: 90%" value=""/> 
									</td>
								</tr>
								
								<tr>
									<th class="cth">주소 (상품체험/회수)</th>
									<td class="ctd" colspan="3">
										<input id="addr" name="addr" type="text" class="txt" style="width: 90%" value=""/> 
									</td>
								</tr>
								<tr>
									<th class="cth">메모</th>
									<td class="ctd" colspan="3">
										<textarea name="memo" id="memo" rows="8" cols="100%"></textarea>
									</td>
								</tr>
								<tr>
									<th class="cth">첨부파일</th>
									<td class="ctd" colspan="3">
										<a href="#" name="fileName" id="fileName" >fileName</a>
									</td>
								</tr>
								
								
								
								
								
								
							</table>
							
							
							
							
							
							<%--
							<!--웹에디터 -->
							<div style="display:none;font-size:1px !important;">
								<textarea id="description" alt="내용" name="description" value="">contents</textarea>
							</div>

							<div style="margin:0 auto 0 85px; z-index: 1" >
								<jsp:include page="/editor/editor.jsp" flush="false">
									<jsp:param name="formId" value="listForm"/>
									<jsp:param name="contentWidth" value="900px" />
									<jsp:param name="contentHeight" value="500px" />
								</jsp:include>
							</div>
							--%>
						</div>
						
						<!--//board list-->						
						</form>
						
						<!-- //content -->
						
					</div>
					<!--btn-->
					<div class="al_right mb35">
						<button type="button" id="btnList">목록으로</button>
					</div>
					<!--//btn-->
					
				</div>
				
			</div>
			<!-- //contentWrap -->
			
		</div>
		<%@ include file="/admin/common/inc/Footer.jsp" %>
		
		
		<!-- //wrap -->
		
		
	
	</body>
</html>